<?php
/**
 * Created by PhpStorm.
 * User: SEO-9
 * Date: 2017/1/17
 * Time: 11:07
 */

namespace app\admin\model;

use think\Db;
use think\Model;
class OrderModel extends Model
{
    protected $name='order';

    /*
     * 订单列表
     */
    public function getOrderlist($map, $start, $limits){
        return $this->field('xx_order.*,username')->join('xx_user', 'xx_user.id = xx_order.uid')->where($map)->limit($start,$limits)->order('id desc')->select();
    }

    /*
     * 删除订单
     */
    public function delOrder($id)
    {
        try{
            $this->where('id', $id)->delete();
            return ['code' => 1, 'data' => '', 'msg' => '删除订单成功'];
        }catch( PDOException $e){
            return ['code' => 0, 'data' => '', 'msg' => $e->getMessage()];
        }
    }
}